import request from '@/utils/request'

// 查询租户列表
export function getTenantList(query) {
  return request({
    url: '/lock/tenant/list',
    method: 'get',
    params: query
  })
}

// 查询租户详情
export function getTenantDetail(id) {
  return request({
    url: '/lock/tenant/' + id,
    method: 'get'
  })
}

// 添加租户
export function addTenant(data) {
  return request({
    url: '/lock/tenant',
    method: 'post',
    data: data
  })
}

// 修改租户
export function updateTenant(data) {
  return request({
    url: '/lock/tenant',
    method: 'put',
    data: data
  })
}

// 删除租户
export function deleteTenant(id) {
  return request({
    url: '/lock/tenant/' + id,
    method: 'delete'
  })
}

// 冻结租户
export function freezeTenant(id) {
  return request({
    url: '/lock/tenant/freeze/' + id,
    method: 'put'
  })
}

// 解冻租户
export function unfreezeTenant(id) {
  return request({
    url: '/lock/tenant/unfreeze/' + id,
    method: 'put'
  })
}

// 续租
export function renewTenant(data) {
  return request({
    url: '/lock/tenant/renew',
    method: 'put',
    data: data
  })
}

// 租户退房
export function checkOutTenant(id) {
  return request({
    url: '/lock/tenant/checkout/' + id,
    method: 'put'
  })
}

// 获取租户绑定的钥匙
export function getTenantKeys(tenantId) {
  return request({
    url: '/lock/tenant/keys/' + tenantId,
    method: 'get'
  })
} 